package test.kdonghwa;

import org.springframework.stereotype.Component;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: kdonghwa
 * Date: 12. 4. 13.
 * Time: 오후 5:32
 * To change this template use File | Settings | File Templates.
 */
@Component
public class MsgListener  implements MessageListener {

    private MsgConverterImpl msgConverter;


    public void setMsgConverter(MsgConverterImpl msgConverter) {
        this.msgConverter = msgConverter;
    }


    @Override
    public void onMessage(Message message) {
        try {
            System.out.println("<====== : " + msgConverter.fromMessage(message));
        } catch (JMSException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
